import { t } from 'i18next'
export interface ISocketServerConfig {
	protocol: string
	url: string
	port: string
	conf_id: string
	conf_name: string
	mt_id: string
	client_id: number //客户端标webSocket注册后才有的
	support_dragdrop: 0 | 1 //针对ie是否可以拖拽
}
export interface IMtChnInfo {
	chn_id: number
	chn_alias: string
}
export interface IWebToNativeDefaultConfig {
	//默认下参格式
	KCMP_REGISTER_REQ: {
		event: string
		server_ip: string
		local_ip: string
		conf_id: string
		conf_name: string
		mt_id: string
		sso_cookie_key: string
		support_monitor: 0 | 1 //是否支持监控终端与画面合成
		video_format: {
			type: number
			h264: number
			frame: number
			bitrate: number
			resolution: number
		}
		browser: string //如是IE,则传ie
		server_site: string
	}
	KCMP_START_MONITOR_CMD: {
		event: 'KCMP_START_MONITOR_CMD'
		conf_id: string //即会议E164
		mt_id: string //合并mt_id和mcuidx
		alias: string
		window_id?: string
		client_id?: number
		v_snd_chn: IMtChnInfo[]
		a_snd_chn: IMtChnInfo[]
	}
	KCMP_UPDATE_STREAM_PARAM_CMD: {
		event: 'KCMP_UPDATE_STREAM_PARAM_CMD'
		mode: 0 | 1 //0-视频1-音频
		src: {
			encrypt: {
				mode: number
				key: string
			}
			payload_formats: {
				real_payload: string
				active_payload: string
			}
			media_formats: {
				sampling: number // 音频采样率，仅音频时需
				chn_num: number // 声道数，仅音频时需
				bitrate: number
				max_frame: number // 帧率，仅视频时需
			}
			rtcp: {
				ip: string
				port: number
			}
		}
		dst: {
			ip: string
			port: number
		}
	}
	KCMP_STOP_PLAY_CMD: {
		event: 'KCMP_STOP_PLAY_CMD'
		dst: {
			ip: string
			port: number
		}[]
	}
	KCMP_SHOW_MONITOR_WINDOW_CMD: {
		event: 'KCMP_SHOW_MONITOR_WINDOW_CMD'
		default_expand: boolean
		screen_x: number
		screen_y: number
		ScreenX: number
		ScreenY: number
	}
	KCMP_SHOW_REVIEW_WINDOW_CMD: {
		client_id: number
		event: 'KCMP_SHOW_REVIEW_WINDOW_CMD'
		init_position: [number, number] // 初始位置x, y
		extend_x: 0 | 1 // 0-向右展开 1-向左展开
		extend_y: 0 | 1 // 0-向下展开 1-向上展开
	}
	KCMP_CLOSE_REVIEW_WINDOW_CMD: {
		event: 'KCMP_CLOSE_REVIEW_WINDOW_CMD'
		client_id: number
	}
	KCMP_CHANGE_REVIEW_CMD: {
		event: 'KCMP_CHANGE_REVIEW_CMD'
		conf_id: string
		mt_id: string
		alias: string
		client_id: number //客户端id
		v_snd_chn: IMtChnInfo[]
		a_snd_chn: IMtChnInfo[]
	}
	KCMP_SHOW_ROLL_CALL_WINDOW_CMD: {
		client_id: number
		event: 'KCMP_SHOW_ROLL_CALL_WINDOW_CMD'
		init_position: [number, number] // 初始位置x, y
		extend_x: 0 | 1 // 0-向右展开 1-向左展开
		extend_y: 0 | 1 // 0-向下展开 1-向上展开
		callpoll_num: number //被点名人
	}
	KCMP_CLOSE_ROLL_CALL_WINDOW_CMD: {
		event: 'KCMP_CLOSE_ROLL_CALL_WINDOW_CMD'
		client_id: number
	}
	KCMP_CLEAR_CALLEE_CMD: {
		event: 'KCMP_CLEAR_CALLEE_CMD'
		client_id: number
	}
	KCMP_UPDATE_CONF_NAME_NTF: {
		event: 'KCMP_UPDATE_CONF_NAME_NTF'
		conf_id: string //即会议E164
		conf_name: string //新的会议名称
	}
}
export const typeEventMap = {
	1: 'KCMP_CHANGE_REVIEW_CMD', //远摇
	2: 'KCMP_CHANGE_CURRENT_CALLEE_CMD',
	3: 'KCMP_CHANGE_NEXT_CALLEE_CMD',
}
export type IMessage =
	| {
			event: 'KCMP_REGISTER_ACK'
			client_id: number
			support_dragdrop: 0 | 1
			version: string
	  }
	| {
			event: 'KCMP_DRAG_DROP'
			window_id: number
			mt_id: string
	  }
	| {
			event: 'KCMP_REVIEW_WINDOW_CLOSE_NTF'
	  }
	| {
			event: 'KCMP_ROLL_CALL_WINDOW_CLOSE_NTF'
	  }
export interface StartMonitorCometd {
	member_type: string
	media_mode: string // 1:视频  2:音频  5:双流
	audio_chnl_num: string
	audio_sample_freq: string
	encrypt_param: {
		encrypt_mode: string
		encrypt_key: string
	}
	double_payload: {
		active_payload: string
		real_payload: string
	}
	dst_addr: {
		ip: string
		port: string
	}
	aaccap: {
		bitrate: string
		max_frame_num: string
	}
	srcrtcp_addr: {
		ip: string
		port: string
	}
}
export interface StopMonitorCometd {
	err_code: string
	mt_id: string
	dst_addr: {
		ip: string
		port: string
	}[]
}
export interface DragDataNativeMonitor {
	client_id: number
	conf_id: string
	mt_id: string
}
export const cpuData = [
	{
		id: 'cpu_1',
		label: t('飞腾'),
		value: '1',
	},
	{
		id: 'cpu_2',
		label: t('龙芯'),
		value: '2',
	},
]
export const sysTypeData = [
	{
		id: 'sys_1',
		label: 'UOS',
		value: '1',
	},
	{
		id: 'sys_2',
		label: t('银河麒麟'),
		value: '2',
	},
	{
		id: 'sys_3',
		label: t('中标麒麟'),
		value: '3',
	},
]
